﻿<form class="form-horizontal" role="form" name="editForm" ng-controller="editCtrl" ng-show="isVisible" show-validation>
    <div class="form-group" ng-if="item.Id">
        <label class="col-sm-2 control-label">@T("Policy.Fields.Id")</label>
        <div class="col-sm-4">
            <div class="form-control-static">{{item.Id}}</div>
        </div>
    </div>
    <div class="form-group">
        <label for="Number" class="col-sm-2 control-label">@T("Policy.Fields.Number")</label>
        <div class="col-sm-4">
            <input type="text" name="Number" class="form-control" ng-model="item.Number" required ng-pattern="/^[0-9]*$/" />
        </div>
    </div>
    <div class="form-group">
        <label for="PlateNo" class="col-sm-2 control-label">@T("Policy.Fields.PlateNo")</label>
        <div class="col-sm-4">
            <input type="text" id="PlateNo" class="form-control" ng-model="item.PlateNo" required />
        </div>
    </div>
    <div class="form-group">
        <label for="TypeOfFuelID" class="col-sm-2 control-label">@T("Policy.Fields.TypeOfFuel")</label>
        <div class="col-sm-4">
            <select class="form-control" id="TypeOfFuelID" ng-model="item.TypeOfFuelID" required>
                @*@foreach (var item in Dictionary("TypesOfFuels"))
                {
                    <option value="@item.Id">
                        @item.Name
                    </option>
                }*@
            </select>
        </div>
    </div>
    <div class="form-group" ng-if="item.StateID">
        <label class="col-sm-2 control-label">@T("Policy.Fields.State")</label>
        <div class="col-sm-4">
            <div class="form-control-static">{{item.StateID | dictionary : 'ApprovalStates'}}</div>
        </div>
    </div>
    <div class="form-group" ng-if="item.UserUserName">
        <label class="col-sm-2 control-label">@T("Policy.Fields.User")</label>
        <div class="col-sm-4">
            <div class="form-control-static">{{item.UserUserName}}</div>
        </div>
    </div>

    @Html.Partial("Person/_Edit")

    <div class="form-group" ng-if="item.WFLogs">
        <label class="col-sm-2 control-label">@T("Policy.Fields.Workflow")</label>
        <div class="col-sm-9">
            <table class="table">
                <tr>
                    <th>User</th>
                    <th>Action</th>
                    <th>State</th>
                    <th>Date</th>
                </tr>
                <tr ng-repeat="log in item.WFLogs">
                    <td>{{log.UserUserName}}</td>
                    <td>{{log.ActionID | dictionary : 'ApprovalActions'}}</td>
                    <td>{{log.StateID | dictionary : 'ApprovalStates'}}</td>
                    <td>{{log.DateCreated | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                </tr>
            </table>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-9">
            <button type="button" class="btn btn-default" ng-click="save()">@T("Common.Save")</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">@T("Common.Cancel")</button>

            <span ng-repeat="action in item.ApprovalActions" class="pull-right">
                <button type="button" class="btn btn-default btn-danger" ng-click="doAction(action)" ng-bind="action"></button>&nbsp;
            </span>
        </div>
    </div>
</form>